//
//  LDAddressPickerView.h
//  zhilian
//
//  Created by 李丹 on 2019/7/23.
//  Copyright © 2019 LZT. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "PGPickerView.h"
#import "LDBottomPopView.h"
@class LDPickerItem;
typedef void(^LDCityPickerHandler)(NSArray *objs, NSString *dsc);
typedef void(^LDCityPickerCancelHandler)(void);
typedef void(^LDPickerViewHandler)(NSArray<LDPickerItem *> *objs, NSString *dsc);

#pragma mark - 选择器数据源model
@interface LDPickerItem : NSObject
@property (nonatomic, copy) NSString* name;
//@property (nonatomic, assign) id obj;
@property (nonatomic, copy) NSString* obj;
@property (nonatomic, copy) NSArray *datas;
/**设备保养用到**/
@property (nonatomic, copy) NSString *type; // 类型（1-公司；2-部门；3-仓库）
@property (nonatomic, copy) NSString *orgId; // 公司ID
/**
 配置model子数据源方法，方法内只是对属性datas进行赋值，其他的属性值通过回调配置
 */
- (void) loadData:(NSInteger)count config:(void(^)(LDPickerItem *item, NSInteger index)) config ;
//获取地址列表
+ (NSMutableArray *)loadData;
@end


@interface LDAddressPickerView : UIView<PGPickerViewDelegate, PGPickerViewDataSource>
@property (nonatomic, strong) PGPickerView *pickerView;
//滚动后自动调用autoSelectedHandler 方法 
@property (nonatomic, assign) BOOL autoEnable;
/**外部加载数据源方法 */
- (void) loadDates:(NSArray<LDPickerItem *> *)datas ;
- (void) didSelectedHandler:(LDPickerViewHandler)handler;
- (void) autoSelectedHandler:(LDPickerViewHandler)handler;

- (instancetype)initWithCompantsCount:(int)compantsCount;
- (instancetype)initWithDepartmentData:(NSArray *)datas;
- (instancetype)initWithDepartmentData:(NSArray *)datas compantsCount:(int)compantsCount;
- (void)show;

@end

